{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "9ad28206",
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "请输入您的账号：orla\n",
      "请输入您的密码：2020\n",
      "欢迎普通用户 orla 登陆系统使用~\n",
      "亲爱的用户，您还有 4 次查看机会\n",
      "您想以哪种方式查看课表：1.查看今天的课表 2.查看指定日期的课表 3.退出系统\n",
      "请输入你的选择: 3\n",
      "您已退出系统，欢迎下次查看\n"
     ]
    }
   ],
   "source": [
    "# 优化课表（运用用户输入+输入指定时间格式）\n",
    "# 调用日历\n",
    "from datetime import datetime\n",
    "from calendar import *\n",
    "\n",
    "#定义这个月几号所对应的星期几\n",
    "Monday = [4,11,18,25]\n",
    "Tuesday = [5,12,19,26]\n",
    "Wednesday = [6,13,20,27]\n",
    "Thursday = [7,14,21,28]\n",
    "Friday = [1,8,15,22,29]\n",
    "Saturday = [2,9,16,23,30]\n",
    "Sunday = [3,10,17,24,31]\n",
    "\n",
    "now =  datetime.today().day\n",
    "time = datetime.now().strftime(\"%Y-%m-%d %H:%M\")\n",
    "\n",
    "\n",
    "# 数据库数据——非会员账号 & 会员账号\n",
    "# 非会员一天可以查看5次，会员一天可以查看10次\n",
    "\n",
    "user_data = \"orla\"\n",
    "password_data = \"2020\"\n",
    "user_data_vip = \"shiloh\"\n",
    "password_data_vip = \"2021\"\n",
    "\n",
    "# 规定输入的次数\n",
    "count = 3\n",
    "while True:\n",
    "    count -= 1\n",
    "# 用户输入数据\n",
    "    username = input(\"请输入您的账号：\")\n",
    "    password = input(\"请输入您的密码：\")\n",
    "    # 1. 先判断账号后判断该账号是否为会员\n",
    "    if user_data == username:\n",
    "        if password_data == password:\n",
    "            count = 5\n",
    "            while True:\n",
    "                count -=1\n",
    "                print(\"欢迎普通用户\",username,\"登陆系统使用~\" )\n",
    "                # 如果为非会员，则print（“你有5次查看机会”）\n",
    "                print(\"亲爱的用户，您还有\",count,\"次查看机会\")\n",
    "                # 选择时间查看课表——1.系统根据当前时间运行出课表 2.用户自己输入时间查看课表\n",
    "                print(\"您想以哪种方式查看课表：1.查看今天的课表 2.查看指定日期的课表 3.退出系统\")\n",
    "                choice = int(input(\"请输入你的选择: \"))\n",
    "                if choice == 1:\n",
    "                    if now in Monday:\n",
    "                        print(time)\n",
    "                        print(\"周一下午有课\");print(\"8-9节 大英 9-302\")\n",
    "                    elif now in Tuesday:\n",
    "                        print(time)\n",
    "                        print(\"周二下午有课\");print(\"8-9节 H5 3实308\")\n",
    "                    elif now in Wednesday:\n",
    "                        print(time)\n",
    "                        print(\"周三有课\");print(\"4-5节 大英 9-202\");print(\"12-14节 创业实践基础 1-402\")\n",
    "                    elif now in Thursday:\n",
    "                        print(\"周四有课\");print(\"4-5节 python 综合楼612\");print(\"8-9节 毛概实践 9-307\");print(\"12-14节 毛概理论 9-201\")\n",
    "                    elif now in Friday:\n",
    "                        print(\"周五上午有课\");print(\"4-5节 AI 综合楼612\")\n",
    "                    elif now in Saturday:\n",
    "                        print(time)\n",
    "                        print(\"Rest.\")\n",
    "                    else:\n",
    "                        print(\"明天又是周一了呜呜呜\")\n",
    "\n",
    "                elif choice == 2:\n",
    "                    # 输入指定时间格式输出课表\n",
    "                    y = input('请输入年份:')\n",
    "                    m = input('请输入月份:')\n",
    "                    d = input('请输入日:')\n",
    "                    # isdigit()检查字符串是否由数字组成\n",
    "                    if y.isdigit() and m.isdigit() and d.isdigit() and 1 <= int(m) <= 12 and 1 <= int(d) <= 31:\n",
    "                        weekday = (int(d))\n",
    "                        if weekday in Monday:\n",
    "                            print(\"周一下午有课\");print(\"8-9节 大英 9-302\")\n",
    "                        elif weekday in Tuesday:\n",
    "                            print(\"周二下午有课\");print(\"8-9节 H5 3实308\")\n",
    "                        elif weekday in Wednesday:\n",
    "                            print(\"周三有课\");print(\"4-5节 大英 9-202\");print(\"12-14节 创业实践基础 1-402\")\n",
    "                        elif weekday in Monday:\n",
    "                            print(\"周四有课\");print(\"4-5节 python 综合楼612\");print(\"8-9节 毛概实践 9-307\");print(\"12-14节 毛概理论 9-201\")\n",
    "                        elif weekday in Monday:\n",
    "                            print(\"周五上午有课\");print(\"4-5节 AI 综合楼612\")\n",
    "                        elif weekday in Monday:\n",
    "                            print(\"Rest.\")\n",
    "                        else:\n",
    "                            print(\"明天又是周一了呜呜呜\")\n",
    "                elif choice == 3:\n",
    "                    print(\"您已退出系统，欢迎下次查看\")\n",
    "                    break\n",
    "        else:\n",
    "            if count == 0:\n",
    "                print(\"您输入的账号或密码不正确，请5分钟后再尝试输入\")\n",
    "                break\n",
    "            else:\n",
    "                print(\"您输入的账号或密码不正确，请重新输入，您还有\", count, \"次机会~加油~\")\n",
    "    else:\n",
    "        if user_data_vip == username:\n",
    "            if password_data_vip == password:\n",
    "                count = 10\n",
    "                while True:\n",
    "                    count -=1\n",
    "                    print(\"欢迎会员用户\",username,\"登陆系统使用~\" )\n",
    "                    # 如果为会员，则print（“你有10次查看机会”）\n",
    "                    print(\"亲爱的会员用户，您还有\",count,\"次查看机会\")\n",
    "                    # 选择时间查看课表——1.系统根据当前时间运行出课表 2.用户自己输入时间查看课表\n",
    "                    print(\"您想以哪种方式查看课表：1.查看今天的课表 2.查看指定日期的课表\")\n",
    "                    choice = int(input(\"请输入你的选择: \"))\n",
    "                    if choice == 1:\n",
    "                        if now in Monday:\n",
    "                            print(time)\n",
    "                            print(\"周一下午有课\");print(\"8-9节 大英 9-302\")\n",
    "                        elif now in Tuesday:\n",
    "                            print(time)\n",
    "                            print(\"周二下午有课\");print(\"8-9节 H5 3实308\")\n",
    "                        elif now in Wednesday:\n",
    "                            print(time)\n",
    "                            print(\"周三有课\");print(\"4-5节 大英 9-202\");print(\"12-14节 创业实践基础 1-402\")\n",
    "                        elif now in Thursday:\n",
    "                            print(\"周四有课\");print(\"4-5节 python 综合楼612\");print(\"8-9节 毛概实践 9-307\");print(\"12-14节 毛概理论 9-201\")\n",
    "                        elif now in Friday:\n",
    "                            print(\"周五上午有课\");print(\"4-5节 AI 综合楼612\")\n",
    "                        elif now in Saturday:\n",
    "                            print(time)\n",
    "                            print(\"Rest.\")\n",
    "                        else:\n",
    "                            print(\"明天又是周一了呜呜呜\")\n",
    "                    elif choice == 2:\n",
    "                        # 输入指定时间格式输出课表\n",
    "                        y = input('请输入年份:')\n",
    "                        m = input('请输入月份:')\n",
    "                        d = input('请输入日:')\n",
    "                        # isdigit()检查字符串是否由数字组成\n",
    "                        if y.isdigit() and m.isdigit() and d.isdigit() and 1 <= int(m) <= 12 and 1 <= int(d) <= 31:\n",
    "                            weekday = (int(d))\n",
    "                            if weekday in Monday:\n",
    "                                print(\"周一下午有课\");print(\"8-9节 大英 9-302\")\n",
    "                            elif weekday in Tuesday:\n",
    "                                print(\"周二下午有课\");print(\"8-9节 H5 3实308\")\n",
    "                            elif weekday in Wednesday:\n",
    "                                print(\"周三有课\");print(\"4-5节 大英 9-202\");print(\"12-14节 创业实践基础 1-402\")\n",
    "                            elif weekday in Monday:\n",
    "                                print(\"周四有课\");print(\"4-5节 python 综合楼612\");print(\"8-9节 毛概实践 9-307\");print(\"12-14节 毛概理论 9-201\")\n",
    "                            elif weekday in Monday:\n",
    "                                print(\"周五上午有课\");print(\"4-5节 AI 综合楼612\")\n",
    "                            elif weekday in Monday:\n",
    "                                print(\"Rest.\")\n",
    "                            else:\n",
    "                                print(\"明天又是周一了呜呜呜\")\n",
    "                    elif choice == 3:\n",
    "                        print(\"您已退出系统，欢迎下次查看\")\n",
    "                        break\n",
    "            else:\n",
    "                if count == 0:\n",
    "                    print(\"您输入的账号或密码不正确，请5分钟后再尝试输入\")\n",
    "                    break\n",
    "                else:\n",
    "                    print(\"您输入的账号或密码不正确，请重新输入，您还有\", count, \"次机会~加油~\")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "16d06182",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.8"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
